Apparatus and method for renaming a data block within a cache

ABSTRACT

A microprocessor apparatus is provided that enables exclusive allocation and renaming of a block of cache lines. The apparatus includes translation logic and execution logic. The translation logic translates a block allocate and rename instruction into a micro instruction sequence that directs a microprocessor to allocate a first block of cache lines in an exclusive state and to copy the contents of a second block of cache lines into the first block of cache lines. The execution logic is coupled to the translation logic. The execution logic receives the micro instruction sequence, and issues transactions over a memory bus that requests the first block of cache lines in the exclusive state. Upon granting of exclusive rights, the execution logic copies the contents of the second block of cache lines into the first block of cache lines.

CROSS-REFERENCE TO RELATED APPLICATIONS

[0001] This application claims the benefit of U.S. ProvisionalApplication Serial No. 60/369575 filed on Apr. 2, 2002, which is hereinincorporated by reference for all intents and purposes.

[0002] This application is related to the following co-pending U.S.patent applications, all of which have a common assignee and commoninventors. SERIAL DOCKET FILING NUMBER NUMBER DATE TITLE 10/364911CNTR.2157 Feb. 11, 2003 PREFETCH WITH INTENT TO STORE MECHANISM10/364919 CNTR.2182 Feb. 11, 2003 PREFETCH WITH INTENT TO STOREMECHANISM FOR BLOCK MEMORY

BACKGROUND OF THE INVENTION

[0003] 1. Field of the Invention

[0004] This invention relates in general to the field ofmicroelectronics, and more particularly to an apparatus and method thatenable a programmer to direct a microprocessor to rename a block ofcache lines within in its internal cache.

[0005] 2. Description of the Related Art

[0006] In a present day microprocessor, the speed at which data can betransferred between internal logic blocks is an order of magnitudefaster than the speed that external memory accesses exhibit. Forexample, in an x86 desktop computer configuration, the bus whichinterfaces to system memory operates at speeds on the order of hundredsof megahertz while internal microprocessor clock speeds are approachingthe tens of gigahertz. Consequently, a hierarchy of cache structures hasevolved over more recent years to allow high-performance microprocessorsto run at speed without having to stall while transactions are executedover a slow memory bus every time data is to be read or written.

[0007] An on-board, or local, cache in a pipeline microprocessor is astand-alone unit by design that operates in a manner transparent to theflow of instructions in the microprocessor pipeline to ensure that datawhich is going to be required by instructions in an application programis resident within the cache and can hence be accessed at pipelinespeeds rather than at memory bus speeds. Cache architectures vary in theart, some consisting of multiple hierarchical levels of cache: a firstlevel cache very near to a processor's execution logic, a second levelcache which may be on-chip or off chip where less frequently accesseddata are stored, third-level caches which may be on a memory carditself, and so on. Regardless of which architecture is employed however,one skilled in the art will appreciate that the overall objective of acache is to preclude situations where instructions in a microprocessorpipeline are stalled while waiting for bus transactions over a slowmemory bus to complete in order to obtain data that is needed by apending read or write operation. When this happens, program executioncomes to a grinding halt until the data arrives.

[0008] To complicate matters, present day computer systems also shareregions of memory between devices. For instance, a primarymicroprocessor communicates with a communications microprocessor byreading data from and writing data to a specified region of memory. Itis also very common to find areas of memory known as video buffers thatare shared between a primary microprocessor and a microprocessor on avideo card that is responsible for displaying data to an operator on avideo device.

[0009] In an shared memory system, the possibility exists that data froma shared region can exist concurrently in the local caches of twodifferent microprocessors or other devices connected to a memory bus.And as long as all of the devices do nothing other than read the data,then no harm is done by allowing both of them to have the data in theirlocal cache structures. But unpredictable consequences could result ifthey were both allowed to modify the data that is locally cached.

[0010] To prevent this from happening, system designers have developedcache consistency protocols that indicate that status of data in acache. The most prevalent protocol is known as MESI. Maintaining a localcache according to MESI ensures that two copies of the same data cannotbe modified at the same time. A MESI shared state indicates to a localcache whether or not a particular block of data is shared. If it isshared, then the local processor cannot modify the block of data withoutfirst conducting transactions over the slower memory bus to obtainexclusive permission to modify the data. To modify data, a processormust first obtain exclusive ownership of the data.

[0011] The problem addressed by the invention described herein concernsthe delay that is incurred in an application program when data iswritten to memory. One skilled in the art will appreciate that a cachehas no reasonable way of knowing when a particular area of memory willfirst be required, and so memory bus delays are generally experiencedwhen the particular area of memory is first loaded into local cache.Recognizing this fact, designers have developed a prefetch instructionthat can be programmed into an application program for execution by amicroprocessor. The prefetch instruction, however, does not operate onoperands in the program flow. Rather, the prefetch instruction directs alocal cache to load operands from memory into the cache that will berequired in the future by subsequent instructions. And since cache unitsinteract with memory in a manner that is transparent to instruction flowin a microprocessor pipeline, it is prudent to issue a prefetchinstruction prior to needing data so that the cache can fetch the datafrom memory before it is needed in parallel with the execution of otherinstructions in the primary program flow. Then when a subsequentinstruction is executed that requires access to the prefetched data, thedata is readily accessible from cache and program execution is notstalled while waiting for it to be fetched from memory. Prefetched datais readily accessible in cache, that is, so long as it is going to beread. If the data is to be modified by a subsequent instruction, thenprogram execution may have to be delayed while a cache unit goes to thebus to request exclusive ownership of the data.

[0012] As alluded to above, shared memory regions are widely employed inpresent day computing systems to allow for communication of informationbetween devices. One very common operation that is encountered invirtually all present day applications is known as a memory copy. Amemory copy operation copies the contents of one memory location toanother memory location. For example, a video buffer that is to betransferred for display is often built up from a number of smallerbuffers. Contents of a first smaller buffer are configured for displayand then copied to a second memory location that is, say, one of fourscreen quadrants. After the screen quadrant is configured, contents ofits memory locations are copied to third memory locations where theentire screen contents reside. One skilled in the art will appreciatethat generation of video buffer data is only one example of the manydifferent tasks that application programs perform where data is copiedfrom one location to the next.

[0013] Memory copy operations appear to be straightforward, but in viewof the employment of hierarchical cache architectures within today'smicroprocessors, such operations actually become quite problematic.Consider that a first data structure, SRC, has been allocated andmodified in a present day cache, then the operations necessary tocomplete a memory copy operation are 1) to allocate and secure exclusiveownership of a second data structure, DEST, to which the contents of SRCare to be copied, and 2) to modify the contents of DEST so that itscontents match the contents of SRC. Yet, as has been described above, ifthe DEST has not been previously allocated in cache, or if DEST has beenallocated, but its contents are shared, then to secure exclusiveownership of DEST requires that the application program be stalled whileappropriate bus transactions are issued over the memory bus. This is aproblem.

[0014] Moreover, the problem above is exacerbated in proportion to thesize of the area of memory that is to be copied. To obtain exclusiveownership of, say, 100 cache lines will stall a program much longer thanthe time it takes to obtain exclusive ownership of a single cache line.

[0015] Therefore, what is needed is an apparatus and method that enablea programmer to direct a microprocessor to obtain exclusive ownership ofa first block of cache lines and to copy data into the first block ofcache lines from a second block of cache lines, where the data is copiedin parallel with execution of subsequent programmed instructions.

[0016] In addition, what is needed is an apparatus and method thatenable a programmer to direct a microprocessor write back data to memoryfrom the first block of cache lines.

SUMMARY OF THE INVENTION

[0017] The present invention, among other applications, is directed tosolving these and other problems and disadvantages of the prior art. Thepresent invention provides a superior technique for copying data fromone block of cache lines in a cache to a second block of cache lines inthe cache while subsequent instructions in a application program areexecuting in parallel. In one embodiment, a microprocessor apparatus isprovided. The microprocessor apparatus includes translation logic andexecution logic. The translation logic translates a block allocate andrename instruction into a micro instruction sequence that directs amicroprocessor to allocate a first block of cache lines in an exclusivestate and to copy the contents of a second block of cache lines into thefirst block of cache lines. The execution logic is coupled to thetranslation logic. The execution logic receives the micro instructionsequence, and issues transactions over a memory bus that requests thefirst block of cache lines in the exclusive state. Upon granting ofexclusive rights, the execution logic copies the contents of the secondblock of cache lines into the first block of cache lines.

[0018] One aspect of the present invention contemplates an apparatus ina microprocessor for performing a block renaming operation. Theapparatus includes a block allocate and rename instruction and atranslator. The block allocate and rename instruction directs themicroprocessor to allocate a first block of cache lines in an exclusivestate and to copy contents of a second block of cache lines to the firstblock of cache lines. The translator receives the block allocate andrename instruction, and translates the block allocate and renameinstruction into associated micro instructions. The associated microinstructions direct execution logic within the microprocessor to issue aplurality of bus transactions over a memory bus that requests exclusiveownership of the first block of cache lines, and to copy the contents ofthe second block of cache lines to the first block of cache lines.

[0019] Another aspect of the present invention comprehends a method forperforming a block memory copy operation. The method includes retrievinga block allocate and rename macro instruction; translating the blockallocate and rename macro instruction into a micro instruction sequence,where the micro instruction sequence directs a microprocessor toallocate a first block of cache lines in the exclusive state, and tocopy the contents of a second block of cache lines to the first block ofcache lines; and responsive to the micro instruction sequence, issuingbus transactions over a memory bus to allocate the first block of cachelines in the exclusive state, and copying the contents of the secondblock of cache lines to the first block of cache lines.

BRIEF DESCRIPTION OF THE DRAWINGS

[0020] These and other objects, features, and advantages of the presentinvention will become better understood with regard to the followingdescription, and accompanying drawings where:

[0021]FIG. 1 is a block diagram illustrating significant pipeline stagesin a present day microprocessor;

[0022]FIG. 2 is a block diagram depicting a cache unit interface tomemory for performing a prefetch operation within the microprocessor ofFIG. 1;

[0023]FIG. 3 is a timing diagram illustrating two possible sets oftransactions that are issued over a memory bus by the microprocessor ofFIGS. 1 and 2 to perform the prefetch operation;

[0024]FIG. 4 is a block diagram showing an extended prefetch instructionaccording to the present invention;

[0025]FIG. 5 is a table illustrating how an extended address specifierfield within the extended prefetch instruction of FIG. 4 is encoded todirect a microprocessor to prefetch a cache line in an exclusive MESIstate;

[0026]FIG. 6 is a block diagram detailing a microprocessor according tothe present invention for performing a prefetch with intent to storeoperation;

[0027]FIG. 7 is a block diagram depicting a cache unit interface tomemory for performing a prefetch with intent to store operation withinthe microprocessor of FIG. 6.

[0028]FIG. 8 is a timing diagram illustrating bus transactions that areissued over a memory bus by the microprocessor of FIGS. 6 and 7 toperform the prefetch with intent to store operation according to thepresent invention;

[0029]FIG. 9 is a block diagram showing an extended block prefetchinstruction according to the present invention;

[0030]FIG. 10 is a block diagram depicting a cache unit interface tomemory for performing a block prefetch and store operation within themicroprocessor of FIG. 6.

[0031]FIG. 11 is a timing diagram illustrating bus transactions that areissued over a memory bus by the microprocessor of FIGS. 6 and 10 toperform the block prefetch and store operation according to the presentinvention;

[0032]FIG. 12 is a flow chart illustrating a method according to thepresent invention for performing a prefetch with intent to storeoperation;

[0033]FIG. 13 is a flow chart illustrating a method according to thepresent invention for performing a block prefetch with intent to storeoperation;

[0034]FIG. 14 is table illustrating how an extended address specifierfield within the extended prefetch instruction of FIG. 4 isalternatively encoded to direct a microprocessor to allocate and renamea cache line;

[0035]FIG. 15 is a block diagram depicting a cache unit interface tomemory for allocating and renaming a cache line within themicroprocessor of FIG. 6;

[0036]FIG. 16 is a flow chart featuring a method according to thepresent invention for allocating and renaming a cache line;

[0037]FIG. 17 is a block diagram depicting a cache unit interface tomemory for allocating and renaming a block of cache lines within themicroprocessor of FIG. 6; and

[0038]FIG. 18 is a flow chart featuring a method according to thepresent invention for allocating and renaming a cache data block.

DETAILED DESCRIPTION

[0039] The following description is presented to enable one of ordinaryskill in the art to make and use the present invention as providedwithin the context of a particular application and its requirements.Various modifications to the preferred embodiment will, however, beapparent to one skilled in the art, and the general principles definedherein may be applied to other embodiments. Therefore, the presentinvention is not intended to be limited to the particular embodimentsshown and described herein, but is to be accorded the widest scopeconsistent with the principles and novel features herein disclosed.

[0040] In view of the above background discussion on how a present daypipeline microprocessor executes a prefetch operation, an examplehighlighting the limitations of present day prefetch techniques will nowbe presented with reference to FIGS. 1-3. Following this, a discussionof the present invention will be presented with reference to FIGS. 4-18.The present invention enables a programmer to direct a microprocessor toallocate a first block of cache lines in its cache in an exclusive MESIstate, and to copy data into the first block of cache lines from asecond block of cache lines in the cache, thereby precluding any programdelay that could result if store instructions were otherwise executed tocopy the data.

[0041] Turning now to FIG. 1, a block diagram is presented illustratingsignificant pipeline stages 101-105 in a present day pipelinemicroprocessor 100. The microprocessor 100 has a fetch stage 101, atranslate stage 102, a register stage 103, an address stage 104, and anexecute stage 105.

[0042] In operation, the fetch stage 101 retrieves macro instructions121-123 from an instruction area 120 of system memory for execution bythe microprocessor 100. The macro instructions 121-123 are provided tothe translate stage 102. The translate stage 102 translates the macroinstructions 121-123 into corresponding sequences of micro (or native)instructions (not shown) that direct the microprocessor 100 to performoperations which are specified by the macro instructions 121-123. Themicro instructions proceed through subsequent stages 103-105 of thepipeline in synchronization with a pipeline clock signal (not shown),very similar to the manner in which work products proceed throughsuccessive stations in an assembly line. Accordingly, micro instructionsare provided to the register stage 103. If a particular microinstruction specifies an operand that is stored within a register in theregister stage 103, then logic therein accesses the register to retrievethe operand and the operand is forwarded along with the particular microinstruction to the address stage 104. The address stage 104 containslogic to generate addresses used to access operands that are stored indata memory 108. Like the register stage 103, the address stage 104forwards generated addresses along with their corresponding microinstructions to the execute stage 105.

[0043] The execute stage 105 performs the operations that are specifiedby the micro instructions. In a present day microprocessor 100, thetypes of operations vary according to instruction set architecture,however one skilled in the art will appreciate that these operationsfall into general categories such as logical operations, arithmeticoperations, and memory access operations (i.e., data read and data writeoperations). Results generated by performing the prescribed operationsare either stored back into registers in the register stage 103 or theyare written to locations in data memory 108.

[0044] One skilled in the art will appreciate that a modern pipelinemicroprocessor 100 may have many more stages than those 101-105 shown inFIG. 1 because increasing the number of stages in a pipeline bydecomposing major functions within the pipeline is a proven techniquefor increasing the throughput of instructions 121-123 through thepipeline. For clarity purposes however, the pipeline stages 101-105 ofthe present day microprocessor 100 shown in FIG. 1 present majorgroupings of functions to illustratively teach shortcomings of the priorart without burdening the reader with irrelevant details.

[0045] It is notable that a present day microprocessor 100 provides adata cache 107 within the execute stage 105 along with execute logic106. The data cache 107 operates in parallel with the execution ofinstructions in the pipeline stages 101-105 to ensure that data whichhas a high probability of being accessed by the instructions 121-123 ofan application program are present within the cache 107 so that when adata access micro instruction (i.e., a load memory or store memory microinstruction) proceeds through the execute stage 105, the execute logic106 is able to execute the data access in one or two pipeline clockcycles rather than incurring a program delay of perhaps hundreds ofclock cycles while waiting for the data access to be executed to systemdata memory 108 over a memory bus 110. In an efficient cache systemconfiguration, data load and store operations occur predominatelybetween the execute logic 106 and the data cache 107 over a cache bus109, and the data cache 107 operates in a manner that is relativelytransparent to the flow of micro instructions through the pipelinestages 102-105 to ensure that cached copies of data entities aresynchronized and consistent with system memory 108.

[0046] The prevailing protocol for ensuring the consistency of cacheentries in a system configuration that shares regions of memory 108 isknown as MESI (MESI is an acronym for the following states: modified,exclusive, shared, and invalid). Although not depicted in FIG. 1, otherdevices (not shown) in a computing system configuration may sharecertain areas of memory 108 for the purposes of operating on the samedata. For example, a video card may share a region of memory 108 withthe microprocessor 100 to enable access of data for display on a monitorwhich has been generated by the microprocessor 100. In another example,multiple devices on the system bus 110 may communicate among themselvesby writing data to and reading data from shared areas of data memory108. It is beyond the scope of the present application to provide adetailed description of the architectural considerations that providethe motivation for use of the MESI protocol; what is sufficient hereinis to understand that MESI is used predominantly in the art as thestandard cache management protocol for ensuring data consistency betweensystem memory 108 and local cache structures 107.

[0047] Because transactions over the memory bus 110 take hundreds ofclock cycles to complete, data is transferred to and from the data cache107 in blocks consisting of a number of bytes. These blocks are calledcache lines. Although cache line widths (i.e., the size of a cache linein bytes) can vary according to architecture, it is not uncommon todayto find system configurations that exhibit 32-byte line widths, or64-byte line widths, or even 128-byte line widths.

[0048] Even the most efficient cache structures 107 must incur delay toinitially transfer data from memory 108 to cache 107 over the memory bus110. But once a cache line has been provided to the cache 107,subsequent accesses to data entities within the cache line can beaccomplished without incurring significant delay because the speed of acache 107 and the cache bus 109 is commensurate with the speed of otherlogic within the microprocessor 100, say, the execute logic 106.

[0049] According to MESI, a cache line within a local data cache 107 maybe in one of four states: modified, exclusive, shared, and invalid. Amodified line is one to which a local store operation has been executed,but which has not yet been synchronized with (i.e., written back to)main memory 108. It is the responsibility of a local cache 107 tomonitor memory transactions over the memory bus 110 from other devices(also known as bus agents) so that if they request data from a modifiedcache line, the local cache 107 provides the modified data to therequesting bus agent. This monitoring of the bus 110 is known as bussnooping.

[0050] A cache line in the exclusive state is one to which the localcache 107 may execute a store operation. The exclusive state impliesthat the local cache 107 possesses exclusive ownership of the cacheline; the microprocessor 100 is thus allowed modify its contents.

[0051] A shared cache line is one that is resident within the localcaches 107 of two or more devices on the bus 110. As such, each devicemay read data from a shared cache line, but they are not allowed tomodify its contents. In order to modify data (i.e., to execute a storeoperation) in a shared cache line, a device 100 must first conductappropriate transactions over the memory bus 110 with the other busagents to obtain exclusive ownership of the cache line (i.e., to readthe cache line into its cache 107 in the exclusive MESI state) prior tomodifying its contents. Once exclusive ownership of the line isobtained, then the store operation may be executed and the cache linestate is changed to modified. Requiring exclusive ownership of a cacheline before posting store operations guarantees data consistency in thatonly one device 100 can modify the contents of a cache line at any pointin time.

[0052] A cache line's state is changed to invalid when the local cache107 detects (by snooping) a write transaction over the memory bus 110 tothat cache line, or when a bus transaction is issued over the bus 110 byanother device to obtain exclusive ownership of the line. Marking a lineas invalid indicates that the data within is not to be read or writtenbecause it is most likely inconsistent with memory 108.

[0053] To exploit the fact that a data cache 107 operates in parallelwith the flow of instructions through a microprocessor pipeline,designers have provided prefetch macro instructions 122 that allow aprogrammer to direct a microprocessor 100 to load data into a cache 107before access to the data is required in a program flow 120, therebyovercoming the delay that would be otherwise incurred when data isretrieved from memory 108 into the cache 107 as a result of directexecution of a load instruction in a program flow 120. A prefetchinstruction 122 is generally provided in a program flow 120 to directthe local data cache 107 to load a cache line from memory 108 inparallel with the execution of subsequent instructions so that the cacheline will be in the cache 107 at the point in the program flow 120 wherean instruction 123 accesses data from within the cache line. In theexample of FIG. 1, a prefetch instruction 122, PREFETCHTO [EAX], directsthat the cache line addressed by the contents of register EAX be loadedinto cache 107 so that its contents will be available when a subsequentdata access instruction 123, MOV EBX, [EAX], is executed in the programflow 120 that directs the microprocessor 100 to read data from anaddress prescribed by register EAX and move it to register EBX. Theprefetch instruction 122 and move instruction 123 within the programflow 120 are depicted according to x86 instruction set architectureconventions for clarity sake because x86 instructions are widelyrecognized. One skilled in the art will appreciate, however, that manyother instruction set architectures provide prefetch instructions 122that direct a microprocessor 100 to read a cache line from memory 108into a local data cache 107 so that delay is not incurred when asubsequent instruction 123 is executed that prescribes a data readoperation from the cache line. If judiciously placed within a programflow 120, prefetch instructions 122 are very efficient for overcomingthe delay associated with initially accessing data in a data cache 107and can thereby provide for substantial increases in program executionspeed. When transactions over the memory bus 110 for the prefetchoperation are completed, the requested cache line is present in cache107 in either an exclusive state (if the local cache 107 has the onlycopy of the cache line) or a shared state (if another device also has acached copy of the requested line) . In either state, data entitieswithin the cached line are available for immediate read access. But asnoted above, in order to write data to a cache line (i.e., to perform astore operation), exclusive ownership of the line is required.Consequently, if the prefetch operation resulted in allocating the linein an exclusive state, then a pending store may be immediately posted tothe line. But if the line was provided from the bus 110 in a sharedstate, then a pending store must be stalled while the cache unit 107issues transactions over the bus 110 to perfect exclusive ownership ofthe line. After the line is provided to the cache 107 in the exclusivestate, then the pending store can be posted.

[0054] Now referring to FIG. 2, a block diagram 200 is provideddepicting a cache unit interface to memory for performing a prefetchoperation within the microprocessor of FIG. 1. The block diagram 200shows logic within the microprocessor 201 that is employed to performthe prefetch operation. The microprocessor 201 has a translator 210 thatreceives a flow of macro instructions 202 and translates the macroinstructions 202 into associated micro instructions 211. Microinstructions 211 that direct data load and store operations from and tomemory 242 are subsequently provided to a cache unit 220. The cache unit220 includes fill logic 221 and a data cache 222. The fill logic 221 iscoupled to a bus unit 230. The bus unit 230 interfaces to a systemmemory bus 240, to which the data memory 242 and other bus agents 241are coupled.

[0055] An exemplary flow of macro instructions 202 illustrates how aprefetch operation is prescribed and how subsequent read and storeoperations may be conducted on the prefetched data. A common example ofthis sequence of operations on a desktop computer is where a counter inmemory is read and incremented. A sequence of prefetch, read, and storeoperations recognizes a need to both read data and to subsequentlymodify data within a cache line. Accordingly, a first macro instruction202, PREFETCH [EAX], in the exemplary flow directs the microprocessor201 to prefetch the cache line whose address corresponds to the contentsof register EAX. A second macro instruction 202, MOV EBX, [EAX], directsthe microprocessor 201 to read the contents of a memory location whoseaddress is prescribed by register EAX and write the contents in registerEBX. A third macro instruction 202, INC EBX, directs the microprocessor201 to increment the contents of register EBX. A fourth macroinstruction 202, MOV [EAX],EBX, directs the microprocessor 201 to storethe contents of register EBX in a memory location corresponding to thecontents of register EAX. The above-detailed prefetch, read, and storeoperations merely increment a value in memory whose address is providedby EAX. It is noted that to effectively employ the prefetch instruction202 would require that it be provided sufficiently in advance of thesecond macro instruction 202, MOV EBX, [EAX], so that the delayassociated with loading the cache line prescribed by the contents of EAXcould be absorbed by parallel execution of intervening macroinstructions 202. For clarity sake, however, the interveninginstructions are not depicted in the block diagram 200.

[0056] The translator 210 translates the prefetch macro instruction 202into a corresponding prefetch micro instruction 211, PREFETCH [EAX],which is provided to the cache unit 220. The fill logic 221 queries thedata cache 222 to determine if the requested line is already residentand valid (i.e., not in an invalid state) within the data cache 222. Ifnot, then the fill logic 221 directs the bus unit 230 to issuetransactions over the system memory bus 240 to obtain the requestedcache line from memory 242. If no other bus agent 241 has a copy of therequested line, then the fill logic 221 provides the requested line tothe data cache 222 in the exclusive state. If one or more of the busagents 241 have a local copy of the requested line, then the fill logic221 writes the line to cache 222 as shared. In either state, therequested line is resident in the cache 222 for following accessoperations.

[0057] The translator 210 translates the second macro instruction 202into a load micro instruction 211, LD EBX,[EAX], directing themicroprocessor to load the contents of the memory address prescribed byregister EAX into register EBX. As previously discussed with referenceto FIG. 1, execute logic (not shown) within the microprocessor 201requests contents of the memory address from the cache unit 220. Becausethe cache line containing the contents is already resident in the datacache 222 as a result of the prefetch operation, it is immediatelyavailable and the load micro instruction 211 is executed without delay.

[0058] The third macro instruction 202 is translated into acorresponding increment micro instruction 211, INC EBX, that directsexecute logic to increment the contents of register EBX. Since no newdata is required, the load micro instruction 211 is not provided to thecache unit 220.

[0059] Finally, the fourth macro instruction 202 in the flow istranslated into a store micro instruction 211, ST [EAX],EBX, thatdirects the execute logic to perform a data store operation to write thecontents of register EBX into the memory location addressed by thecontents of register EAX. The store micro instruction 211 is thusprovided to the cache unit 220 as a pending store operation.Accordingly, the fill logic 221 detects that the cache line targeted forthe pending store operation is present in the data cache 222. If thecache line is in the exclusive state, then the pending store may beimmediately posted and the line's state is changed to modified. If, onthe other hand, the cache line is shared, then the cache unit 220asserts a stall signal 223 to halt the progression of micro instructions211 through the pipeline stages of the microprocessor 201 while the filllogic 221 directs the bus unit 230 to conduct transactions over thesystem bus 240 to obtain exclusive ownership of the cache line. Onceexclusive ownership is obtained, the pending store is allowed to postits data to the cache line and the stall signal is terminated, therebyallowing program execution to resume.

[0060] Consider now a type of operation where data is simply going to bewritten to memory without a requirement to first read the data, or atype of operation where data is to be read, but it is positivelycontemplated that a store will be subsequently posted. In these cases,program delay can be minimized with certainty by executing a priorprefetch instruction only for the case where data is to be read first.And in this case, if a requested cache line is provided exclusively as aresult of the prefetch, then program delay associated with the storeoperation is precluded. But if the cache line is provided from memory ina shared state as a result of the prefetch, then delay associated withthe store operation is incurred in either case. This is a problembecause present day instruction set architectures do not provide a wayto direct a microprocessor 201 exclusively fetch a cache line into datacache 222. Although cache lines can be provided in response to aprefetch operation as exclusive, such a state cannot be guaranteed. Thisis because prefetch macro instructions 202 architecturally presume thatprefetched data is to be read, and the resulting transactions over thesystem bus 240 request that the cache line be fetched regardless ofwhether it is shared or not. For example, in the x86 architecture, thetransaction issued over the memory bus 240 as a result of execution ofan x86 prefetch instruction is a data read transaction. The data readtransaction requests a copy of a cache line without regard to its state.

[0061] Turning to FIG. 3, a timing diagram is presented that illustratesthe two possible sets 301, 302 of bus transactions which are issued overa memory bus 240 by the microprocessor 201 of FIGS. 1 and 2 to perform aprefetch and subsequent store operation. The two sets 301, 302 oftransactions include request transactions 303 from the bus unit 230 tothe memory bus 240 and response transactions 304 from the memory bus 240back to the bus unit 230 within the microprocessor 201. Transaction set301 depicts those transactions 303-304 that are conducted when arequested cache line is provided exclusively as a response to a prefetchoperation; transaction set 302 depicts those transactions 303-304 thatare conducted when the requested line is provided in a shared MESI statein response to the prefetch. As described above with reference to FIG.2, when a prefetch instruction is executed, the fill logic 221 directsthe bus unit 230 to issue a data read request 303, DATA READ [EAX], tothe memory bus 240 requesting that the cache line prescribed by registerEAX be provided to the local cache 222. The data read request 303 isissued at time A in set 301 and time D in set 302. In response, thememory bus 240 sends a data response 304 back to the bus unit 230 thatincludes the requested cache line. If the cache line is providedexclusively, then the data response 304, DATA RESP [EAX].E, of set 301is sent back at time B to the bus unit 230. If the cache line is shared,then the data response 304, DATA RESP [EAX] .S, of set 302 is sent backat time E to the bus unit 230. At this point, the data can be read fromcache 222 without incurring bus transaction delay.

[0062] When a subsequent store operation to the provided cache line isencountered, then the scenario of transaction set 302 illustrates whattransactions 303, 304 must occur in order to post the store operation.In transaction set 301, since the cache line was initially provided asexclusive, then all that is required to post the store is to issue adata write transaction 303, DATA WRITE [EAX], at time C over the bus 240to write the data to memory 242. But as transaction set 302 illustrates,before a data write 303 can be issued at time H, transactions 303, 304at times F and G must first be conducted to raise the ownership statusof the cache line from shared to exclusive. At time F, a data read andinvalidate request 303, DATA READ/INV [EAX], is sent by the bus unit 230requesting exclusive ownership of the shared cache line. And perhapshundreds of cycles later at time G, a response 304, DATA RESP [EAX] .E,is received from the bus 240 upgrading the state of the cache line toexclusive. After the response 304 is received at time G, then the datawrite 303 can be posted to the bus 240 at time H.

[0063] It is noted that the transaction sets 301, 302 depicted in FIG. 3are presented in generic terms because different microprocessorarchitectures employ different semantics to illustrate bus transactions303, 304. In addition, it is noted that all of the transactions to firstgain access to the data bus 240 (e.g., BUS REQUEST, BUS GRANT, etc.)have been omitted from the timing diagram of FIG. 3 for claritypurposes.

[0064] The present inventors have observed that present data prefetchinstructions are limited in that they do not support positivelycontemplated store operations where it is advantageous to prefetch acache line into cache 222 with the express intent of executing a storeto the cache line—a prefetch with intent to store operation—regardlessof whether contents of the cache line are read prior to posting a storeto the cache line. If one observes the transactions 303, 304 of set 302,it is evident that prefetching a cache line in the shared state isuseful only when that line is going to be read prior to posting a storeto it. If a store is going to be posted to the line by execution of asubsequent instruction, then program execution must be delayed while thestate of the line is upgraded from shared to exclusive.

[0065] Programmers recognize the limitations of present day prefetchinstructions, yet they employ them in prefetch-with-intent-to-storesituations because it is possible (although perhaps not probable) to begranted exclusive ownership of a cache line in response to a data readrequest simply because no other bus agent possesses a local copy of therequested line. The present inventors have observed that it is moredesirable, however, to entirely circumvent the possibility ofprefetching a cache line in a shared state and to rather direct amicroprocessor 201 to prefetch a cache line in the exclusive state. Thepresent invention is directed toward an apparatus and method forobtaining exclusive ownership of a first block of cache lines, and forcopying data into the first block of cache lines from a second block ofcache lines, and for optionally writing back data from the second blockof cache lines to memory, thereby freeing up those resources within thecache. The present invention will now be discussed with reference toFIGS. 4-18.

[0066] Referring to FIG. 4, a block diagram is presented showing anextended prefetch instruction 400 according to the present invention.The extended prefetch instruction 400 includes an optional plurality ofprefix entities 401, followed by a prefetch opcode 402, which isfollowed by an extended address specifier 403. In one embodiment, eachof prefix and extended address entities 401, 403 are 8-bits in size andthe prefetch opcode entity 402 is one or two bytes in size and allentities 401-403 conform to the x86 instruction set architecture exceptas modified herein.

[0067] Operationally, the prefetch opcode 402 is a specific opcode valuethat directs a conforming microprocessor to perform a prefetchoperation. In an x86 embodiment, the specific value of the opcode entity401 is 0F18h. One or more optional prefix entities 401 may be employedto direct a conforming microprocessor to force certain types ofadditional operations such as repeating the operation for a number oftimes defined by a counter (e.g., in x86 architecture, the REP prefix),forcing an atomic operation (e.g., in x86 architecture, a LOCK prefix),etc. The extended address specifier 403 is employed to prescribe thespecific type of prefetch operation that is to be executed. In an x86embodiment, the extended address specifier 403 is also known as theModR/M byte 403.

[0068] When an extended prefetch macro instruction 400 is detected by amicroprocessor according to the present invention, the microprocessor isdirected to prefetch data into cache from memory according to hintvalues as specified by contents of the extended address specifier 403,an example of which will now be discussed with reference to FIG. 5.

[0069]FIG. 5 is a table 500 illustrating how one embodiment of anextended address specifier field 403 within the extended prefetchinstruction 400 of FIG. 4 is encoded to direct a microprocessoraccording to the present invention to prefetch a cache line in anexclusive MESI state. For the purposes of teaching the presentinvention, ModR/M bit fields conforming to the x86 architecture areemployed, however, it is contemplated that the present inventioncomprehends any architecture providing the means whereby aprefetch-exclusive hint may be encoded into an instruction 400. Althoughthe example of FIG. 5 is directed toward encoding the prefetch-exclusive(or prefetch with intent to store) hint into an extended addressspecifier 403, one skilled in the art will appreciate that the prefetchhint could as well be encoded as a specific opcode value in an opcodefield 401.

[0070] In the exemplary encoding, an x86 ModR/M byte encodes the type ofprefetch operation prescribed by a prefetch opcode 401 in bits 5:3 ofthe ModR/M byte. Presently, the x86 prefetch instruction allows values000, 001, 010, and 011 to prescribe prefetch hints that are intended forread operations. All four values 000-011 direct an x86 microprocessor toprefetch data into its caches with varying degrees of closeness. Forexample, a To hint (i.e., value 001), directs the microprocessor toprefetch a cache line into all levels of cache hierarchy, while an NTAhint directs the microprocessor to prefetch a cache line into anon-temporal cache structure and into a location close to the processor,while minimizing cache pollution. But the common feature of the x86prefetch hints encoded as 000-011 is that a data read request is issuedover the bus that requests a copy of a cache line regardless of its MESIstate. One embodiment of the present invention encodes an additionalhint in the extended address specifier that directs a microprocessoraccording to the present invention to prefetch a prescribed cache lineusing an exclusive (.S) hint. FIG. 5 shows the prefetch-exclusive hintencoding as value 100 in bits 5:3 of an x86 ModR/M byte. When theprefetch.s hint is encoded in a prefetch instruction 400 according tothe present invention, a conforming microprocessor is directed to issuetransactions over a memory bus to prefetch data in the exclusive MESIstate. In an x86 embodiment, the specific transaction that is issuedresponsive to a prefetch.s hint in the prefetch instruction 400 is adata read and invalidate transaction, such as has been previouslydescribed with reference to FIG. 3B. In that example, the data read andinvalidate transaction was required to raise the state of a shared cacheline to the exclusive state.

[0071] In the x86 instruction set architecture, encoding of bits 5:3 as100 has heretofore been declared illegal, as is shown in the table 500for values 101-111. An illegal ModR/M byte encoding results in anexception. But in an x86 embodiment according to the present invention,the additional encoding to perfect a prefetch-exclusive hint isconsidered legal and will result in the aforementioned bus transactionsto prefetch a cache line in the exclusive state.

[0072] It is acknowledged that since the interaction of cache structureswith memory is removed from the flow of instructions through amicroprocessor pipeline, the extended prefetch instruction 400 can onlyrequest that prefetching be performed according to the hints provided.If a cache is not presently occupied with memory accesses, then prefetchoperations are executed. But if a cache is otherwise busy, prefetchoperations are deferred until the memory accesses are completed.

[0073] Now referring to FIG. 6, a block diagram is presented detailing amicroprocessor 600 according to the present invention for performing aprefetch with intent to store operation. The microprocessor 600 hasthree notable stage categories: fetch, translate, and execute. The fetchstage has fetch logic 601 that retrieves macro instructions into aninstruction cache 602 from an instruction memory 603. The retrievedmacro instructions are provided to the translate stage via aninstruction queue 604. The translate stage has translation logic 606that is coupled to a micro instruction queue 608. The translation logic606 includes extended translation logic 607. The execute stage hasexecution logic 609 that includes an extended cache unit 610. Theextended cache unit 610 has a data cache 611, that is coupled toextended fill logic 612. The extended fill logic 612 is coupled to a busunit 613. The bus unit 613 is coupled to a data memory 614.

[0074] In operation, the fetch logic 601 retrieves formattedinstructions according to the present invention into the instructioncache 602 from the instruction memory 603, and provides the macroinstructions in the instruction queue 604 in execution order. The macroinstructions are retrieved from the instruction queue 604 and areprovided to the translation logic 606. The translation logic 606translates each of the provided macro instructions into a correspondingmicro instruction sequence that directs the microprocessor 600 toperform the operations prescribed by the macro instructions. Theextended translation logic 607 detects extended prefetch macroinstructions according to the present invention and also provides fortranslation of corresponding extended prefixes and address specifierentities. In an x86 embodiment, the extended translation logic 607 isconfigured to detect an x86 prefetch instruction and to translate theModR/M byte of the x86 prefetch instruction according to the conventionsdescribed with reference to FIGS. 4-5 into a prefetch micro instructionsequence directing the microprocessor 600 to exclusively prefetch acache line into data cache 611.

[0075] The micro instructions are routed from the micro instructionqueue 608 to the execution logic 609, wherein the extended cache unit610 is configured to execute an exclusive prefetch operation accordingto the present invention. When a prefetch micro instruction sequence isexecuted by the execution logic 609, the extended fill logic 612 directsthe bus unit 613 to issue transactions over a memory bus 615 to the datamemory 614 requesting that a prescribed cache line be prefetched intothe data cache 611 in the exclusive MESI state.

[0076] One skilled in the art will appreciate that the microprocessor600 described with reference to FIG. 6 is a simplified representation ofa pipeline microprocessor 600 according to the present invention. Infact, as alluded to above, today's pipeline microprocessor architecturescomprise many pipeline stages. However, these stages can be generallycategorized into the three stage groups shown in the block diagram andthus, the block diagram of FIG. 6 serves to teach the essential elementsthat are required to implement embodiments of the present invention asdescribed hereinabove. Those elements of a microprocessor 600 which areextraneous to the present discussion, for clarity, are not depicted.

[0077] Turning to FIG. 7, a block diagram 700 is presented depicting acache unit interface to memory for performing a prefetch and storeoperation within the microprocessor of FIG. 6. The block diagram 700shows logic within the microprocessor 600 that is employed to performthe prefetch operation. The microprocessor 701 has an extendedtranslator 710 that receives a flow of macro instructions 702 andtranslates the macro instructions 702 into associated micro instructions711. Micro instructions 711 that direct data load and store operationsfrom and to memory 742 are subsequently provided to an extended cacheunit 720. The extended cache unit 720 includes extended fill logic 721and a data cache 722. The extended fill logic 721 is coupled to a busunit 730. The bus unit 730 interfaces to a system memory bus 740, towhich the data memory 742 and other bus agents 741 are coupled.

[0078] An exemplary flow of macro instructions 702 illustrates how aprefetch operation is prescribed and how subsequent read and storeoperations are be conducted on the prefetched data. As described abovewith reference to FIG. 2, a common example of this sequence ofoperations on a desktop computer is where a counter in memory is readand incremented. However, in contrast to the microprocessor 201 of FIGS.1-2, a microprocessor 701 according to the present invention whendirected to exclusively prefetch a cache line is effective ineliminating bus transaction delay that would otherwise be associatedwith subsequent store instructions, regardless of whether or notprefetched data is to be read by intervening instructions. The exampleflow of macro instructions 702 presented in FIG. 7 contemplates a dataread operation prior to performing a store operation on prefetched data,however, one skilled in the art will appreciate that data can also beprefetched exclusively and subsequently written without an interveningread operation.

[0079] Accordingly, an extended prefetch instruction 702, PREFETCH.S[EAX], in the exemplary flow directs the microprocessor 701 toexclusively prefetch the cache line whose address corresponds to thecontents of register EAX. A second macro instruction 702, MOV EBX,[EAX], directs the microprocessor 701 to read the contents of a memorylocation whose address is prescribed by register EAX and write thecontents in register EBX. A third macro instruction, INC EBX, directsthe microprocessor 701 to increment the contents of register EBX. Afourth macro instruction, MOV [EAX],EBX directs the microprocessor 701to store the contents of register EBX in a memory location correspondingto the contents of register EAX. It is noted that to effectively employthe exclusive prefetch instruction 702, PREFETCH.S [EAX], would requirethat it 702 be executed sufficiently in advance of the second macroinstruction 702, MOV EBX,[EAX], so that the delay associated withloading the cache line prescribed by the contents of EAX could beabsorbed by parallel execution of intervening macro instructions 702.For clarity sake, however, the intervening instructions are not depictedin the block diagram 700.

[0080] The translator 710 translates the extended prefetch macroinstruction 702 into a corresponding exclusive prefetch microinstruction 711, PREFETCH.S [EAX] which is provided to the extendedcache unit 720. The extended fill logic 721 queries the data cache 722to determine if the requested line is already resident and valid (i.e.,not in an invalid state) within the data cache 722. If not, then theextended fill logic 721 directs the bus unit 730 to issue transactionsover the system memory bus 740 to obtain the requested cache line frommemory 742 in the exclusive MESI state. If no other bus agent 741 has acopy of the requested line, then the extended fill logic 721 providesthe requested line to the data cache 722 in the exclusive state. If oneof the bus agents 741 has a local copy of the requested line in theexclusive state, then according to the specific bus transaction protocolthat is employed, it snoops the transaction on the bus 740 requestingthe line and invalidates its local copy. If the local copy has beenmodified, then the bus agent writes the modified data out to the bus 740allowing the microprocessor 701 to obtain exclusive ownership of theline. If more than one bus agent 741 shares the line, then they allinvalidate their local copies so that the line is provided to themicroprocessor 701 in the exclusive state. In either of the cases, therequested line is provided to the cache 722 in the exclusive state andis available for a subsequent store operation.

[0081] The translator 710 translates the second macro instruction 702into a load micro instruction 711, LD EBX,[EAX], directing themicroprocessor to load the contents the memory address prescribed byregister EAX into register EBX. Because the cache line containing thecontents is already resident in the data cache 722 as a result of theprefetch with intent to store operation, it is immediately available andthe load micro instruction 711 is executed without delay.

[0082] The third macro instruction 702 is translated into acorresponding increment micro instruction 711, INC EBX, that directsexecute logic to increment the contents of register EBX. Since no newdata is required, the load micro instruction 711 is not provided to theextended cache unit 720.

[0083] Finally, the fourth macro instruction 702 in the flow istranslated into a store micro instruction 711, ST [EAX],EBX, thatdirects the execute logic to perform a data store operation to write thecontents of register EBX into the memory location addressed by thecontents of register EAX. The store micro instruction 711 is thusprovided to the extended cache unit 720 as a pending store operation.Accordingly, the fill logic 721 detects that the cache line targeted forthe pending store operation is present in the data cache 222 and as aresult of the exclusive prefetch, the cache line is in the exclusivestate. Consequently, the store can be posted without delay. In contrastto the microprocessor 201 of FIG. 2, the extended cache unit 720according to the present invention need not assert a stall signal 723 topost the pending store because the target cache line was exclusivelyprefetched.

[0084] Now turning to FIG. 8, a timing diagram 800 is presentedillustrating bus transactions 801, 802 that are issued over a memory bus740 by the microprocessor of FIGS. 6 and 7 to perform the prefetch withintent to store operation according to the present invention. Thetransactions 801, 802 include request transactions 801 from the bus unit730 to the memory bus 740 and response transactions 802 from the memorybus 740 back to the bus unit 730 within the microprocessor 701. Thetiming diagram 800 depicts those transactions 801, 802 that areconducted when a cache line is requested and provided exclusively as aresponse to a prefetch with intent to store operation that is prescribedby a prefetch-exclusive macro instruction according to the presentinvention. Accordingly, when a prefetch-exclusive instruction isexecuted, the extended fill logic 721 directs the bus unit 730 to issuea data read and invalidate request 801, DATA READ/INV [EAX], to thememory bus 740 requesting that the cache line prescribed by register EAXbe provided to the local cache 722 in the exclusive MESI state. The dataread and invalidate request 801 is issued at time A. In response, thememory bus 740 sends a data response 802, DATA RESP [EAX].E, back to thebus unit 230 at time B providing the requested cache line in theexclusive MESI state. At this point, the data can be read from cache 222or written to by a store operation without incurring bus transactiondelay. A data write transaction 801, DATA WRITE [EAX], is shown in thetiming diagram 800 to occur at a time C later when a subsequent storeinstruction in program flow has directed the microprocessor to modifythe cache line that was exclusively obtained. One skilled in the artwill appreciate that the data write transaction 801 need not be presentat all because it is not one of the transactions that are required toperfect exclusive ownership of a cache line.

[0085] As noted with reference to FIG. 3, the transactions 801, 802depicted in FIG. 8 are presented in generic terms because differentmicroprocessor architectures employ different semantics to illustratebus transactions 801, 802. The transactions 801, 802 depicted in FIG. 8roughly follow x86 conventions, but such depiction is only intended toteach the present invention. Such convention is not intended to restrictapplication of the present invention to a particular instruction setarchitecture. In addition, it is noted that all of the transactions tofirst gain access to the data bus 740 (e.g., BUS REQUEST, BUS GRANT,etc.) have been omitted from the timing diagram 800 for claritypurposes.

[0086] The present invention not only contemplates exclusive prefetch ofa single cache line, but also comprehends those situations where it isdesired to modify a block of data. Accordingly, embodiments directedtoward exclusively prefetching a block of data will now be discussedwith reference to FIGS. 9-11.

[0087]FIG. 9 is a block diagram showing an extended block prefetchinstruction 900 according to the present invention. The extended blockprefetch instruction 900 includes an optional plurality of prefixentities 901, one of which is a repeat prefix 901. The prefix entities901 are followed by a prefetch opcode 902, which is followed by anextended address specifier 903. In one embodiment, each of prefix andextended address entities 901, 903 are 8-bits in size, and the prefetchopcode entity 902 is one or two bytes in size and all entities 901-903conform to the x86 instruction set architecture except as modifiedherein. In such an embodiment, the x86 repeat prefix (REP) 901 isemployed to indicate a block prefetch operation.

[0088] operationally, the prefetch opcode 902 is a specific opcode valuethat directs a conforming microprocessor to perform a prefetchoperation. In an x86 embodiment, the specify value of the opcode entity901 is 0F18h. The extended address specifier 903 is employed to specifythe specific type of prefetch operation that is to be executed. In anx86 embodiment, the extended address specifier 903 is the ModR/M byte903.

[0089] In substantial similarity to the above discussion with referenceto FIG. 4, when a prefetch macro instruction 900 is detected by amicroprocessor according to the present invention, the microprocessor isdirected to prefetch data into cache from memory according to hintvalues as specified by contents of the extended address specifier 903.The encoding example described with reference to FIG. 5 describesencoding of prefix hints in the block extended address specifier 903 aswell. However, if the microprocessor detects a repeat prefix 901 withinthe extended prefetch instruction 900, then the microprocessor attemptsto prefetch a specified number of cache lines into its local cache inthe exclusive state, where the number of cache lines is prescribed in anarchitectural register within the microprocessor. In one embodiment, thenumber of cache lines is specified within register ECX in anx86-compatible microprocessor.

[0090] Referring to FIG. 10, a block diagram 1000 is presented depictinga cache unit interface to memory for performing a block prefetch andstore operation within the microprocessor 600 of FIG. 6. Identificationand operation of the elements within the microprocessor 1001 of FIG. 10are similar to those like elements within the microprocessor 701 of FIG.7, where the hundreds digit is replaced by a 10. To perfect an exclusiveblock prefetch operation according to the present invention, an extendedtranslator 1010 is enabled to translate an extended prefetch instructionwith a repeat prefix 1002 into a micro instruction sequence 1011directing an exclusive block prefetch operation. In addition, a shadowcount register 1013 is provided to which the number of cache lines to beprefetched is loaded from an architectural register 1012. And extendedblock fill logic 1021 is provided to direct the bus unit 1030 to requestexclusive prefetch of the specified block of cache lines, and to providethose lines into the data cache 1022 upon receipt.

[0091] To initiate an exclusive block prefetch operation, a first macroinstruction 1002, MOV ECX,COUNT, is provided to initialize architecturalregister ECX with the number of cache lines in the block that are to beprefetched exclusively. The extended translator 1010 translates thefirst macro instruction into a load micro instruction 1011, LDECX,COUNT, directing the microprocessor to load the count into ECX. Whenthe count is loaded into ECX, it is also transparently copied into theshadow count register 1013, SHECX. At this point, other instructions1002 may modify the architectural register 1012 without disturbing thecount for the prefetch operation.

[0092] Following initialization of the count, an extended block prefetchinstruction 1002, REP.PREF.S [EAX], is translated by the extendedtranslator 1010 that directs the microprocessor 1001 to prefetch thenumber of cache lines prescribed by ECX into local cache in theexclusive state, where the address of the first cache line to beprefetched is prescribed in register EAX. Responsive to a microinstruction sequence 1011 directing the exclusive block prefetchoperation, the extended block fill logic 1021 directs the bus unit 1030to issue bus requests over the memory bus 1040 requesting the cachelines beginning at the address prescribed by EAX in the exclusive state.The fill logic 1021 receives these lines as they arrive and allocatesthem into the data cache 1022. Once entered into the cache in theexclusive state, any or all of the prefetched cache lines may bemodified without incurring additional delay.

[0093] Now turning to FIG. 11, a timing diagram 1100 is presentedillustrating bus transactions 1101, 1102 that are issued over a memorybus 1040 by the microprocessor 1001 of FIGS. 6 and 10 to perform theblock prefetch and store operation according to the present invention.For illustrative purposes, the example of FIG. 11 presumes 32-byte cachelines in a system configuration. One skilled in the art will appreciatefrom the following example, however, that the present inventioncomprehends any cache line width that is contemplated in a systemconfiguration. The transactions 1101, 1102 include request transactions1101 from the bus unit 1030 to the memory bus 1040 and responsetransactions 1102 from the memory bus 1040 back to the bus unit 1030within the microprocessor 1001. The timing diagram 1000 depicts thosetransactions 1001, 1002 that are conducted when a block of cache linesis requested and provided exclusively as a response to a block prefetchwith intent to store operation that is prescribed by aprefetch-exclusive macro instruction according to the present inventionthat includes a repeat prefix. Accordingly, when a blockprefetch-exclusive instruction is executed, the extended fill logic 1021directs the bus unit 1030 to issue a plurality of data read andinvalidate requests 1101 that correspond to the number of cache linesspecified within the architectural register. The plurality of requestsincludes the addresses of the all of the cache lines in the cache lineblock, as initially specified by contents of an architectural register,EAX. Although the bus requests 1101 are provided in ascending addressorder, it is noted that the present invention comprehends descendingorder, random ordering, and staggered ordering to accommodate theconventions of different memory bus protocols. A first data read andinvalidate request 1101 is issued at time A, a second request 1101 attime B, and so on until a final request 1101 is provided at time D. Inmany architectures, bus responses 1102 are tagged and consequently, theymay begin to arrive at time C prior to completion of the last request.At time C, at least one cache line in the block is available for apending store. However, to ensure that delay is minimized, it isrecommended that store operations to the block of lines be postponeduntil time E, when all of the responses 1102 have been received in theexclusive state.

[0094] In response, the memory bus 1040 sends a data response 802, DATARESP [EAX].E, back to the bus unit 1030 at time B providing therequested cache line in the exclusive MESI state. At this point, thedata can be read from cache 1022 or written to by a store operationwithout incurring bus transaction delay. As was noted above in thediscussion with reference to FIG. 8, a subsequent write transaction1101, DATA WRITE [EAX], may be executed without delay as a result of asubsequent store operation because the block of cache lines wasexclusively obtained. The data write transaction 1101, however, does notresult from execution of the exclusive block prefetch instruction.

[0095] Now referring to FIG. 12, a flow chart 1200 is presentedillustrating a method according to the present invention for performinga prefetch with intent to store operation.

[0096] Flow begins at block 1202 where a flow of macro instructions isprovided to an instruction queue according to the present invention.Flow then proceeds to block 1204.

[0097] At block 1204, a next macro instruction is fetched from theinstruction queue and provided to an extended translator. Flow thenproceeds to decision block 1206.

[0098] At decision block 1206, an evaluation is made to determine if thenext macro instruction is an extended prefetch instruction. If so, thenflow is directed to block 1208. If not, then flow proceeds to block1210.

[0099] At block 1208, a detected extended prefetch instruction istranslated into a prefetch with intent to store micro instructionsequence that directs a microprocessor to prefetch a specified cacheline in the exclusive state. Flow then proceeds to block 1212.

[0100] At block 1210, the macro instruction is translated into acorresponding micro instruction sequence directing the microprocessor toperform a specified operation. Flow then proceeds to block 1212.

[0101] At block 1212, a next micro instruction sequence is provided toexecute logic in the microprocessor. Flow then proceeds to decisionblock 1214.

[0102] At decision block 1214, the next micro instruction sequence isevaluated to determine if it is a prefetch with intent to storesequence. If so, then flow is directed toward block 1216. If not, thenflow proceeds to block 1218.

[0103] At block 1216, responsive to the prefetch with intent to storesequence, bus transactions are issued to a memory bus requestingexclusive ownership of a prescribed cache line. In response, the cacheline is provided to the microprocessor in the exclusive MESI state andis thus available for store operations without incurring bus delay toraise the state of the line so that it can be modified. Flow is thendirected to block 1220.

[0104] At block 1218, the next micro instruction sequence is executed.Flow then proceeds to block 1220.

[0105] At block 1220, the method completes.

[0106] Now turning to FIG. 13, a flow chart 1300 is presentedillustrating a method according to the present invention for performinga block prefetch with intent to store operation.

[0107] Flow begins at block 1302 where a flow of macro instructions isprovided to an instruction queue according to the present invention.Flow then proceeds to block 1304.

[0108] At block 1304, a next macro instruction is fetched from theinstruction queue and provided to an extended translator. Flow thenproceeds to decision block 1306.

[0109] At decision block 1306, an evaluation is made to determine if thenext macro instruction is an extended block prefetch instruction. If so,then flow is directed to block 1310. If not, then flow proceeds to block1308.

[0110] At block 1310, a detected extended block prefetch instruction istranslated into a block prefetch with intent to store micro instructionsequence that directs a microprocessor to prefetch a specified number ofcache lines in the exclusive state. Flow then proceeds to block 1312.

[0111] At block 1308, the macro instruction is translated into acorresponding micro instruction sequence directing the microprocessor toperform a specified operation. Flow then proceeds to block 1312.

[0112] At block 1312, a next micro instruction sequence is provided toexecute logic in the microprocessor. Flow then proceeds to decisionblock 1314.

[0113] At decision block 1314, the next micro instruction sequence isevaluated to determine if it is a prefetch with intent to storesequence. If so, then flow is directed toward block 1318. If not, thenflow proceeds to block 1316.

[0114] At block 1316, the next micro instruction sequence is executed.Flow then proceeds to block 1328.

[0115] At block 1318, responsive to the block prefetch with intent tostore sequence, a temporary counter is initialized to zero to monitorthe number of bus transactions that will be issued requesting exclusiveownership of a block of cache lines. Flow then proceeds to block 1320.

[0116] At block 1320, a first cache line address is prescribed for afirst data read and invalidate bus transaction. The first cache lineaddress is derived from an address prescribed by the extended blockprefetch instruction, to which is added a cache line width multiplied bythe count of block 1318. Since the count is initialized to zero, thefirst cache line address is equal to that prescribed by the extendedblock prefetch instruction. Flow then proceeds to block 1322.

[0117] At block 1322, a data read and invalidate transaction is issuedover the memory bus to prefetch the first cache line in the exclusiveMESI state. Flow then proceeds to block 1324.

[0118] At block 1324, the count is incremented and flow is directed todecision block 1326.

[0119] At decision block 1326, an evaluation is made to determine is theincremented count is equal to the number of cache lines to beprefetched, as stored in a shadow register. If not, flow proceeds toblock 1320, where another iteration is executed to fetch a next cacheline. If count equals contents of the shadow register, then all bustransaction have been issued and flow is directed to block 1328.

[0120] At block 1328, the method completes.

[0121] The present invention is widely applicable to a number of cacherelated problems where potential data modification operations arecontemplated. Alternative embodiments also comprehend scenarios where aprogrammer desires to direct a microprocessor to obtain exclusiveownership of a single cache line or a block of cache lines, with theexpress intent of overwriting whatever data may exist therein. In suchcases, it is entirely unnecessary to prefetch the cache lines into localcache; all that is required is to exclusively allocate the lines withinthe local cache. And the present inventors have noted that many memorybus architectures provide a bus transaction that may be employed toexclusively allocate cache lines without the overhead required toadditionally transfer the contents of the cache lines from memory tolocal cache. This bus transaction is generally known as a zero-lengthread and invalidate transaction. The zero-length read and invalidatetransaction directs all bus agents having local copies of a prescribedcache line to change its state to invalid. The read transaction iszero-length because no data is transferred in response. This type oftransaction 303 could be employed at time F to request exclusiveownership of the cache line prescribed by EAX in the example of FIG. 3because the data has already been read. At time A in the example of FIG.8, and at times A, B, and D in the example of FIG. 11, it iscontemplated that prefetch of the contents of the prescribed cache linesare required as well as obtaining exclusive ownership thereof. Thefollowing embodiments are directed toward cases where exclusiveownership only is desired because it is the programmer's intent tomodify the contents of the prescribed cache lines.

[0122] As alluded to above, memory copy operations are ubiquitouslyemployed in present day applications, particularly to configure videobuffers. To recap, larger areas of a video display are configured fromnumerous smaller areas. When a given smaller area has been completelyconfigured, then its contents are copied to a corresponding part of oneof the larger areas. Depending upon the complexity of the application, ahierarchy of increasingly large areas may be employed. And one skilledin the art will appreciate that memory copy operations can be veryefficiently executed within a local microprocessor cache because mostlocal cache structures do not require that the contents of a first partof the cache have to actually be copied to the second part of the cachein order to perfect a memory copy; it is only necessary to change theaddresses of the first part of the cache (i.e., the source location) sothat they comport with a destination location in memory. Designers referto this technique for performing a memory copy in local cache as a“rename” or “renaming” operation. Hence, a cache line is renamed whenits address, or tag, is modified to reference a different memorylocation, while its contents are not modified. Alternative embodimentsof the present invention are uniquely suited to provide programmers withadvantageous capabilities to direct a microprocessor according to thepresent invention to rename single cache lines or blocks of cache linesvia extended prefetch instructions that are operative in parallel withthe execution of subsequent program instructions.

[0123] Turning now to FIG. 14, a table 1400 is presented depicting analternative encoding of an extended address specifier entity accordingto the present invention for allocating and renaming a cache line in alocal data cache. And like the encoding embodiment discussed withreference to FIG. 5, for the purposes of teaching the present invention,ModR/M bit fields conforming to the x86 architecture are employed,however, it is contemplated that the present invention comprehends anyarchitecture supporting the mechanism whereby an allocate and renamehint may be encoded into an extended prefetch instruction 400. Althoughthe example of FIG. 14 is directed toward encoding the allocate andrename hint into an extended address specifier 403, one skilled in theart will appreciate that the rename hint could alternatively be encodedas a specific opcode value in an opcode field 401 of any unusedinstruction.

[0124] The alternative encoding embodiment of FIG. 14 extends thecapabilities of a microprocessor 600 according to the present inventionto allow for the specification of implicitly performed memory copyoperations to cache lines that are exclusively allocated. Allocation andrename operations such as are herein described are extremely powerfulfor improving the execution speed of application programs because storeinstructions otherwise required to rename a cache line or a block ofcache lines are entirely eliminated from a program flow. FIG. 14 showsthe allocate and rename hint as value 100 in bits 5:3 of an x86 ModR/Mbyte. When the allocate and rename hint is encoded in a prefetchinstruction 400 according to the present invention, a conformingmicroprocessor is directed to issue transactions over a memory bus tolocally allocate specified cache lines in the exclusive MESI state,without fetching the contents of the cache lines. Like the encodingembodiment discussed with reference to FIG. 5, in an x86 embodiment ofthe present invention, this encoding is considered legal and will resultin zero-length data read and invalidate bus transactions to obtain acache line in the exclusive state without necessitating transfer of itscontents.

[0125] Now referring to FIG. 15, a block diagram 1500 is presenteddepicting a cache unit interface to memory for performing an allocateand rename operation within the microprocessor of FIG. 6. In thisembodiment, a rename operation on an exclusively fetched cache line isexecuted, responsive to an allocate and rename instruction encoded asdescribed with reference to FIG. 14. The block diagram 1500 shows logicwithin the microprocessor 1501 that is employed to perform the allocateand rename operation. The microprocessor 1501 has an extended translator1510 that receives a flow of macro instructions 1502 and translates themacro instructions 1502 into associated micro instructions 1511. Microinstructions 1500 that direct data load and store operations from and tomemory 1542 are subsequently provided to an extended cache unit 1520.The extended cache unit 1520 includes extended cache logic 1521 and adata cache 1522. The extended cache logic 1521 is coupled to a bus unit1530. The bus unit 1530 interfaces to a system memory bus 1540, to whichthe data memory 1542 and other bus agents 1541 are coupled.

[0126] An exemplary flow of macro instructions 1502 illustrates how anallocate and rename operation according to encoding 100 of FIG. 14 isprescribed and how implicit store operations are conducted on adestination area 1525 of local cache 1522 so that its contents matchthose of a source area 1524, thus accomplishing a memory copy, orrenaming operation within local cache 1522 in parallel with theexecution of subsequent program instructions.

[0127] Accordingly, a MOV EDI,#DEST macro instruction 1502 is translatedby the translator 1510 into a LD EDI, #DEST micro instruction 1511,directing the microprocessor 1501 to load value DEST into architecturalregister EDI 1505. “DEST” is the address of a first cache line to whichcontents of a second cache line, SRC, are to be copied. The LD EDI,#DEST is provided to execution logic (not shown), which loads DEST intoEDI 1505. Following this, the translator 1510 translates an extendedallocate and rename instruction 1502, PREF.R [SRC], in the exemplaryflow into an allocate and rename micro instruction 1511, PREF.R[SRC],that directs the microprocessor 1501 to obtain exclusive access rightsto the cache line whose address is provided by the contents of registerEDI 1505, and to perform a renaming operation within the local cache1522 to copy the contents of cache line SRC 1524 to cache line DEST1525. In an optional embodiment, the extended allocate and renameinstruction, PREF.R[SRC] 1502, and its corresponding micro instruction1511 direct the microprocessor 1501 to additionally write back (i.e.,flush) the contents of cache line SRC 1524 to free up resources withinthe data cache. The optional embodiment is configured to overcometroublesome least-recently-used cache management algorithms that wouldotherwise indicate that cache line SRC 1524 is more recently used whenit is the programmer's intent to release those resources.

[0128] The allocate and rename micro instruction 1511 is provided to theextended cache unit 1520. Therein, the extended cache logic 1521 directsthe bus unit 1530 to issue zero-length read and invalidate transactionsover the system memory bus 1540 to obtain exclusive ownership of therequested cache line from memory 1542. When exclusive ownership of therequested line is granted, the extended cache logic 1521 directs thedata cache 1522 to rename area SRC 1524 to the destination addressspecified in EDI 1505, and to mark its MESI state as modified. Anotherembodiment contemplates a copy operation within the cache 1522 ratherthan a renaming operation to actually copy the contents of area SRC 1524to area DEST 1525 once exclusive ownership of DEST has been granted. Inthe optional embodiment, once the renaming operation is completed, theextended cache logic 1521 directs the bus unit 1530 to issue data writetransactions over the bus 1540 to flush the contents of area SRC 1524back to memory 1542, thereby freeing up storage area within the cache1522.

[0129] Now referring to FIG. 16, a flow chart 1600 is presentedillustrating a method according to the present invention for performingan allocate and rename operation on a cache line.

[0130] Flow begins at block 1602 where a flow of macro instructions isprovided to an instruction queue according to the present invention.Flow then proceeds to block 1604.

[0131] At block 1604, a next macro instruction is fetched from theinstruction queue and provided to an extended translator. Flow thenproceeds to decision block 1606 .

[0132] At decision block 1606, an evaluation is made to determine if thenext macro instruction is an extended prefetch instruction encoded toprescribe an allocate and rename operation on a cache line. If so, thenflow is directed to block 1608. If not, then flow proceeds to block1610.

[0133] At block 1608, the detected extended prefetch instruction istranslated into an allocate and rename micro instruction sequence thatdirects a microprocessor to obtain exclusive ownership of a firstspecified cache line and, upon grant of exclusive ownership, to copycontents of a second cache line into the first cache line. The addressof the first cache line is stored in an architectural register of themicroprocessor. Optionally, the allocate and rename micro instructionsequence directs the microprocessor to flush the contents of the secondcache line back to memory. Flow then proceeds to block 1612.

[0134] At block 1610, the macro instruction is translated into acorresponding micro instruction sequence directing the microprocessor toperform a specified operation. Flow then proceeds to block 1612.

[0135] At block 1612, a next micro instruction sequence is provided toexecute logic in the microprocessor. Flow then proceeds to decisionblock 1614.

[0136] At decision block 1614, the next micro instruction sequence isevaluated to determine if it is an allocate and rename sequence. If so,then flow is directed toward block 1616. If not, then flow proceeds toblock 1618.

[0137] At block 1616, responsive to the allocate and rename sequence,bus transactions are issued to a memory bus requesting exclusiveownership of a prescribed cache line. In response, exclusive accessrights to the prescribed cache line are granted by the bus. Flow thenproceeds to block 1620.

[0138] At block 1620, the contents of the second cache line (SRC) arecopied to the first cache line (DEST) by extended cache logic accordingto the present invention. Alternatively, the second cache line isrenamed to indicate a cache tag corresponding to the first cache line.Flow is then directed to block 1624. Optionally, flow is directed toblock 1622.

[0139] At block 1618, the next micro instruction sequence is executed.Flow then proceeds to block 1624.

[0140] At optional block 1622, contents of the second cache line DESTare flushed to memory. Flow then proceeds to block 1624.

[0141] At block 1624, the method completes.

[0142]FIG. 17 is a block diagram 1700 that depicts a cache unitinterface to memory for performing a block allocate and rename operationwithin the microprocessor 1701 of FIG. 6. Identification and operationof the elements within the microprocessor 1701 of FIG. 17 are similar tothose like elements within the microprocessor 1501 of FIG. 15, where thehundreds digit is replaced by a 7. To perfect a block allocate andrename operation according to the present invention, an extendedtranslator 1710 is enabled to translate an extended allocate and renameinstruction with a repeat prefix 1702 as described with reference toFIG. 9 into a micro instruction sequence 1711 directing a block allocateand rename operation. In addition, a shadow count register 1713 isprovided to which the number of cache lines to be allocated and renamedis loaded from an architectural register 1712, ECX. And extended cacheblock logic 1721 is provided to direct the bus unit 1730 to requestexclusive ownership of the specified block of cache lines 1725, DEST,and to rename those lines in the data cache 1722 upon receipt so thattheir contents match those of a source block of cache lines 1724, SRC,and to optionally direct the bus unit to flush the source block of cachelines 1724 to memory 1742 after the memory copy is completed.

[0143] To initiate a block allocate and rename operation, a first macroinstruction 1002, MOV ECX,#COUNT, is provided to initializearchitectural register ECX 1712 with the number of cache lines in theblock 1725 that are to be allocated and renamed. The extended translator1710 translates the first macro instruction 1702 into a load microinstruction 1711, LD ECX,#COUNT, directing the microprocessor 1701 toload the count into ECX 1712. When the count is loaded into ECX 1712, itis also transparently copied into the shadow count register 1713, SHECX.At this point, other instructions 1702 may modify the contents of ECX1712 without disturbing the count for the allocate and rename operation.

[0144] Following initialization of the count, a second macro instruction1702, MOV EDI,#DEST, is provided to the translator 1710 that directs themicroprocessor 1701 to load a specified address, DEST, intoarchitectural register EDI 1705. The translator 1710 translates thesecond macro instruction 1702 into a load micro instruction 1711, LDEDI,#DEST, directing the microprocessor 1701 to load DEST into EDI 1705.

[0145] Following load of DEST in EDI 1705, a block allocate and renameinstruction 1702, REP.PREF.R [SRC], is translated by the extendedtranslator 1710. The block allocate and rename instruction 1702 directsthe microprocessor 1701 to allocate and rename the number of cache linesprescribed by ECX into local cache in the exclusive state, including thecache line specified by the contents of EDI 1705. Responsive to a microinstruction sequence 1711 directing the exclusive block allocate andrename operation, the extended cache block logic 1721 directs the busunit 1730 to issue bus requests over the memory bus 1740 requestingexclusive ownership of the cache lines whose address includes DEST. Theextended cache block logic 1721 allocates each of the COUNT lines intothe data cache 1722 as exclusive ownership is granted, and copies intothem the contents of location SRC 1724. Optionally, upon completion ofthe block allocate and rename operation, the contents of location SRC1724 are flushed to memory 1742, thereby freeing up internal cacheresources.

[0146] Now turning to FIG. 18, a flow chart 1800 is presentedillustrating a method according to the present invention for performinga cache data block allocate and rename operation.

[0147] Flow begins at block 1802 where a flow of macro instructions isprovided to an instruction queue according to the present invention.Flow then proceeds to block 1804.

[0148] At block 1804, a next macro instruction is fetched from theinstruction queue and provided to an extended translator. Flow thenproceeds to decision block 1806.

[0149] At decision block 1806, an evaluation is made to determine if thenext macro instruction is a block allocate and rename instruction. Ifso, then flow is directed to block 1810. If not, then flow proceeds toblock 1808.

[0150] At block 1810, a detected block allocate and rename instructionis translated into a block allocate and rename micro instructionsequence that directs a microprocessor to obtain exclusive ownership ofa specified number of first cache lines and to modify the contents ofthe first cache lines at a destination address such that they are thesame as the contents of second cache lines at a source address. Flowthen proceeds to block 1812.

[0151] At block 1808, the macro instruction is translated into acorresponding micro instruction sequence directing the microprocessor toperform a specified operation. Flow then proceeds to block 1812.

[0152] At block 1812, a next micro instruction sequence is provided toexecute logic in the microprocessor. Flow then proceeds to decisionblock 1814.

[0153] At decision block 1814, the next micro instruction sequence isevaluated to determine if it is a block allocate and initializesequence. If so, then flow is directed toward block 1818. If not, thenflow proceeds to block 1816.

[0154] At block 1816, the next micro instruction sequence is executed.Flow then proceeds to block 1830.

[0155] At block 1818, responsive to the block allocate and renamesequence, a temporary counter is initialized to zero to monitor thenumber of cache lines in a block of cache lines that are to beexclusively allocated and renamed. Flow then proceeds to block 1820.

[0156] At block 1820, first source SRCADDR and first destination DSTADDRcache line addresses are prescribed for a first allocate and renameoperation. The first destination cache line address DSTADDR is providedas contents of a previously loaded architectural register to which isadded a cache line width multiplied by the count of block 1818. Sincethe count is initialized to zero, the first cache line address is equalto that prescribed by the architectural register. Flow then proceeds toblock 1822.

[0157] At block 1822, a data read and invalidate transaction is issuedover the memory bus to allocate the first cache line at DSTADDR in theexclusive MESI state. Flow then proceeds to block 1824.

[0158] At block 1824, the exclusively allocated cache line at DSTADDR ismodified to contain the contents of the first source cache line atSRCADDR. In one embodiment, contents of SRCADDR are copied into DSTADDR.In an alternative embodiment, DSTADDR is renamed to SRCADDR. In anoptional embodiment, contents of SRCADDR are additionally flushed tomemory. Flow then proceeds to block 1826.

[0159] At block 1826, the count is incremented and flow is directed todecision block 1828.

[0160] At decision block 1828, an evaluation is made to determine is theincremented count is equal to the number of cache lines to be allocatedand renamed, as stored in a shadow register to which the count wascopied. If not, flow proceeds to block 1820, where another iteration isexecuted to allocate and rename a next destination cache line. If thecount equals the contents of the shadow register, then all allocate andrename operations have been completed for the block of cache lines andflow is directed to block 1830.

[0161] At block 1830, the method completes.

[0162] Although the present invention and its objects, features, andadvantages have been described in detail, other embodiments areencompassed by the invention as well. For example, the present inventionhas been characterized herein as providing advantages for pending storeoperations or eliminating store operations altogether in accordance withthe MESI protocol. MESI has been selected to exemplify the presentinvention because of its prevalent use in the art. However, it is notedthat the present invention provides for prefetching of data into a localcache in such a form, or state, that it can be immediately modifiedwithout a need to issues transactions to a memory bus. Whether that formor state accords with MESI is inconsequential.

[0163] As noted earlier, cache line width varies according toarchitecture. In desktop systems, 32-byte cache lines prevail today. Butsuch representation of the present invention is not intended to restrictits application to 32-, 64-, 128-, or even 256-byte cache lines. On thecontrary, it is contemplated that the present invention is applicable toany system architecture that restricts modification of local cache linesand which does not provide for direct prefetch of those lines so thatthey can be immediately modified without resorting to bus transactionsto obtain permission to do so.

[0164] Furthermore, the present invention has been illustrativelydescribed with reference to embodiments conforming to the x86architecture. Certainly, x86-compatible microprocessors will benefitfrom incorporation of the present invention, but it is noted that thescope of the present invention extends beyond the boundaries of thex86-compatible community because many different architectures employprefetch instructions that do not ensure a return of exclusive data.

[0165] Finally, it is noted that although an address specifier isemployed herein to specify an address of a cache line to be allocatedand renamed, such specification need not be explicit. An embodiment ofan allocate and rename instruction according to the present inventioncould implicitly specify an architectural register that contains theaddress, where a prior instruction is executed to load the address intothe architectural register.

[0166] Those skilled in the art should appreciate that they can readilyuse the disclosed conception and specific embodiments as a basis fordesigning or modifying other structures for carrying out the samepurposes of the present invention, and that various changes,substitutions and alterations can be made herein without departing fromthe spirit and scope of the invention as defined by the appended claims.

What is claimed is:
 1. A microprocessor apparatus, for performing ablock memory copy operation, the apparatus comprising: translationlogic, configured to translate a block allocate and rename instructioninto a micro instruction sequence that directs a microprocessor toallocate a first block of cache lines in an exclusive state and to copythe contents of a second block of cache lines to said first block ofcache lines; and execution logic, coupled to said translation logic,configured to receive said micro instruction sequence, and configured toissue transactions over a memory bus that request said first block ofcache lines in said exclusive state, and configured to copy saidcontents of said second block of cache lines to said first block ofcache lines.
 2. The microprocessor apparatus as recited in claim 1,wherein the block memory copy operation occurs in parallel withexecution of subsequent instructions in a program flow of an applicationprogram.
 3. The microprocessor apparatus as recited in claim 2, whereinthe block memory copy operation eliminates program delays correspondingto execution of subsequent store instructions which would otherwise berequired in said program flow to copy said contents of said second blockof cache lines to said first block of cache lines.
 4. The microprocessorapparatus as recited in claim 1, wherein said block allocate and renameinstruction comprises a modification to an existing prefetch instructionwithin an existing instruction set, and wherein said existing prefetchinstruction does not otherwise provide for allocation and rename of saidfirst block of cache lines.
 5. The microprocessor apparatus as recitedin claim 4, wherein said existing instruction set comprises the x86instruction set and wherein said existing prefetch instruction comprisesthe x86 prefetch instruction.
 6. The microprocessor apparatus as recitedin claim 4, wherein said allocation and rename instruction comprises arepeat prefix and a prefetch opcode field within an extended addressspecifier entity, and wherein a specific value of said prefetch opcodefield directs said microprocessor to allocate a first destination cacheline in said exclusive state and to copy contents of a first sourcecache line to said first destination cache line, and wherein othervalues of said prefetch opcode field direct said microprocessor toexecute other types of prefetch operations according to said existinginstruction set.
 7. The microprocessor apparatus as recited in claim 6,wherein said prefetch opcode field comprises bits 5:3 within the ModR/Mbyte of an x86 prefetch instruction.
 8. The microprocessor apparatus asrecited in claim 7, wherein said repeat prefix field directs saidmicroprocessor to allocate and rename a specified number of cache lines,and wherein said specified number of cache lines comprises said firstdestination cache line.
 9. The microprocessor apparatus as recited inclaim 8, wherein said specified number is prescribed by contents of anarchitectural register within said microprocessor.
 10. Themicroprocessor apparatus as recited in claim 1, wherein, responsive tosaid micro instruction sequence, said execution logic directs a bus unitto issue said transactions over said memory bus.
 11. The microprocessorapparatus as recited in claim 9, wherein said transactions comprises aplurality of zero-length read and invalidate transactions that requestexclusive ownership of said first block of cache lines.
 12. Themicroprocessor apparatus as recited in claim 1, wherein contents of anarchitectural register containing the number of cache lines within saidfirst block of cache lines are transparently copied into a shadowregister for use by said execution logic during performance of the blockmemory copy operation.
 13. The microprocessor apparatus as recited inclaim 1, wherein said memory bus conforms to the x86 architecture. 14.The microprocessor apparatus as recited in claim 1, wherein saidexecution logic flushes contents of said second block of cache lines tomemory.
 15. An apparatus in a microprocessor for performing a blockrenaming operation, the apparatus comprising: a block allocate andrename instruction, configured to direct the microprocessor to allocatea first block of cache lines in an exclusive state and to copy contentsof a second block of cache lines to said first block of cache lines; anda translator, configured to receive said block allocate and renameinstruction, and configured to translate said block allocate and renameinstruction into associated micro instructions, wherein said associatedmicro instructions direct execution logic within the microprocessor toissue a plurality of bus transactions over a memory bus that requestsexclusive ownership of said first block of cache lines, and to copy saidcontents of said second block of cache lines to said first block ofcache lines.
 16. The apparatus as recited in claim 15, wherein the blockrenaming operation is performed in parallel with execution of otherprogram instructions in a program flow.
 17. The apparatus as recited inclaim 15, wherein said block allocate and rename instruction comprises amodification to an existing prefetch instruction within an existinginstruction set, and wherein said existing prefetch instruction does nototherwise provide for the block renaming operation.
 18. The apparatus asrecited in claim 17, wherein said existing instruction set comprises thex86 instruction set and wherein said existing prefetch instructioncomprises the x86 prefetch instruction.
 19. The apparatus as recited inclaim 18, wherein said block allocate and rename instruction comprises arepeat prefix field and prefetch opcode field within an extended addressspecifier entity, and wherein a specific value of said prefetch opcodefield directs the microprocessor to allocate a first destination cacheline in said exclusive state and to copy contents of a first sourcecache line to said first destination cache line, and wherein othervalues of said prefetch opcode field direct the microprocessor toexecute other types of prefetch operations according to said existinginstruction set.
 20. The apparatus as recited in claim 19, wherein saidprefetch opcode field comprises bits 5:3 of an ModR/M byte within an x86prefetch instruction.
 21. The microprocessor apparatus as recited inclaim 19, wherein said repeat prefix field directs said microprocessorto allocate and rename a specified number of cache lines, and whereinsaid specified number of cache lines comprises said first destinationcache line.
 22. The microprocessor apparatus as recited in claim 21,wherein said specified number is prescribed by contents of anarchitectural register within said microprocessor.
 23. The apparatus asrecited in claim 15, wherein, responsive to said associated microinstructions, said execution logic directs a bus unit to issue saidplurality of bus transactions over said memory bus.
 24. The apparatus asrecited in claim 23, wherein said plurality of bus transactions comprisea plurality of zero-length read and invalidate transactions.
 25. Themicroprocessor apparatus as recited in claim 15, wherein contents of anarchitectural register containing the number of cache lines within saidfirst block of cache lines are transparently copied into a shadowregister for use by said execution logic during performance of the blockmemory copy operation.
 25. The apparatus as recited in claim 15, whereinsaid memory bus conforms to the x86 architecture.
 26. The apparatus asrecited in claim 15, wherein said execution logic writes back contentsof said second block of cache lines to memory.
 27. A method forperforming a block memory copy operation, comprising: retrieving a blockallocate and rename macro instruction; translating the block allocateand rename macro instruction into a micro instruction sequence, whereinthe micro instruction sequence directs a microprocessor to allocate afirst block of cache lines in the exclusive state, and to copy thecontents of a second block of cache lines to the first block of cachelines; and responsive to the micro instruction sequence, issuing bustransactions over a memory bus to allocate the first block of cachelines in the exclusive state, and copying the contents of the secondblock of cache lines to the first block of cache lines.
 28. The methodas recited in claim 27, wherein said issuing comprises: enabling themicroprocessor to execute subsequent instructions in parallel with saidissuing.
 29. The method as recited in claim 27, wherein said retrievingcomprises: providing the block allocate and rename instruction as amodification of an existing prefetch instruction within an existinginstruction set, wherein the existing prefetch instruction does nototherwise provide for allocation of the first block of cache lines inthe exclusive state and for copying the contents of the second block ofcache lines to the first block of cache lines.
 30. The method as recitedin claim 29, wherein said providing comprises: modifying an x86 prefetchinstruction to enable specification of the block memory copy operation.31. The method as recited in claim 30, wherein the block allocate andrename instruction comprises a repeat prefix field and prefetch opcodefield within an extended address specifier entity, and wherein aspecific value of the prefetch opcode field directs the microprocessorto allocate a first destination cache line in the exclusive state, andto copy the contents of a first source cache line to the firstdestination cache line, and wherein other values of the prefetch opcodefield direct the microprocessor to execute other types of prefetchoperations according to the existing instruction set.
 32. The method asrecited in claim 34, wherein the prefetch opcode field comprises bits5:3 of an x86 ModR/M byte within an x86 prefetch instruction.
 33. Themethod as recited in claim 31, wherein said modifying comprises:directing the microprocessor to allocate and rename a specified numberof cache lines; and obtaining the specified number of cache lines fromcontents of an architectural register; wherein the specified number ofcache lines includes the first destination cache line.
 34. The method asrecited in claim 27, wherein said issuing comprises: providing aplurality of zero-length read and invalidate transactions over thememory bus that requests exclusive ownership of the first block of cachelines.
 35. The method as recited in claim 27, wherein said comprises:transparently copying the contents of an architectural register thatcontains the number of cache lines for the block memory copy operationinto a shadow register.
 36. The method as recited in claim 27, furthercomprising: flushing contents of the second block of cache lines tomemory.